<?php
	session_start();
	require_once("db.php");
	
	$respond = "";
	
	if(connect_db()){
		// username and password sent from form
		$username=$_POST['username'];
		$email=$_POST['email'];

		$tbl_name="pengguna"; // Table name

		$sql="SELECT * FROM $tbl_name WHERE username='$username'";
		$result=mysql_query($sql);
		$count=mysql_num_rows($result);			

		if($count>0)
			$respond = "0 ";
		else
			$respond = "1 ";
		
		$sql="SELECT * FROM $tbl_name WHERE email='$email'";
		$result=mysql_query($sql);
		$count=mysql_num_rows($result);
		
		if($count>0)
			$respond .= "0";
		else
			$respond .= "1";
		
		echo $respond;
	}
?>
